Skip to content

Conversation

rsill-neo4j
Copy link
Contributor

this is missing JavaScript examples for processing query data.
i tried, but it wasn't straight-forward to set up something locally (because of the CORS policy) and i got stuck setting up an apache server. at that point i decided to rather ask for help, because my JavaScript certainly would have been lacking anyway ;)

@neo4j-docops-agent
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-graphql-274.surge.sh

New pages:

Updated pages:


[source, javascript, indent=0]
----
// JavaScript example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// JavaScript example
async function createCustomer(contactName) {
const mutation = `
mutation CreateCustomer($contactName: String!) {
createCustomers(input: [{ contactName: $contactName }]) {
customers {
contactName
customerID
}
}
}
`;
const res = await fetch(API_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query: mutation, variables: { contactName } }),
});
const json = await res.json();
return json;
}

customerID is also returned to highlight that a new customer was created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants